namespace GameToolkit.BehaviourTree
{
    /// <summary>
    /// 行为树执行组件
    /// </summary>
    public interface IBehaviourTreeBinder
    {
        BehaviourTreeAsset behaviourTreeAsset { get; }
        BehaviourTreePlayer GetPlayerForAsset(BehaviourTreeAsset asset);
    }

    public enum EBlackboardAction
    {
        Unset,
        Reset,
    }

    /// <summary>
    /// 行为树执行组件
    /// </summary>
    public interface IBehaviourTreeExecutable : IBehaviourTreeBinder, IComponent
    {
        #region blackboard
        event System.Action<string, EBlackboardAction> OnSetBlackboard;
        bool IsBlackboardSet(string varName);
        void UnsetBlackboard(string varName);
        void SetBlackboard<T>(string varName, T value);
        bool GetBlackboard<T>(string varName, out T value);
        void VisitAllValues(System.Action<string, object> valueEditor);
        #endregion
    }

    /// <summary>
    /// 行为树执行上下文状态
    /// </summary>
    public interface IBehaviourTreeContext
    {
        int LoopersCount { get; }
        BehaviourTreeLooper GetLooper(int index);
    }
}
